# 约瑟夫环
lst = [i for i in range(1,101)]
def ysf(lst,num):
    if len(lst) == 1:
        return lst[0]

    cour = 0
    index = 0
    while len(lst) > 1:
        cour += 1
        if cour == num:
            lst.pop(index)
            cour = 0
        else:
            index += 1

        if len(lst) == index:
            index = 0
    print(lst[0])

ysf(lst,5)
